<script setup lang="ts">
const worker = new Worker("http://localhost:5173/baseUse.js", {
  type: "module",
});

worker.addEventListener("message", (e) => {
  console.log(e.data);
  worker.postMessage("收到");
});
</script>

<template>
  <div class="">
    <h1>WebWorker基本使用</h1>
    <button @click="() => worker.postMessage(1)">发送</button>
  </div>
</template>

<style lang="scss" scoped></style>
